<?php 
	jimport('joomla.application.component.model');
	class kinh_doanhModeldat_sp extends JModel
	{
	   //lay danh sach sp theo ID_cha
       function ds_sp($id_cha)
       {
         $db = &JFactory::getDBO();
         $sql = "SELECT ep.name, wh.number_of, wh.id as id_wh
                    FROM hff_erp_product ep, hff_erp_agent_branch_warehouse wh
                    WHERE ep.id_product = wh.id_product
                    AND wh.id_a_b = '".$id_cha."'
                ORDER BY ep.name";
         
         $db->setQuery($sql);
         //echo "<pre>";
         //print_r($db->loadObjectList());
         //echo "</pre>";
         //die;
         return $db->loadObjectList();
       }
	}